<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActiveScaffold::Actions::List</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActiveScaffold::Actions::List</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/active_scaffold/lib/actions/list_rb.html">
                vendor/plugins/active_scaffold/lib/actions/list.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000322">do_list</a>&nbsp;&nbsp;
      <a href="#M000316">included</a>&nbsp;&nbsp;
      <a href="#M000317">index</a>&nbsp;&nbsp;
      <a href="#M000321">list</a>&nbsp;&nbsp;
      <a href="#M000323">list_authorized?</a>&nbsp;&nbsp;
      <a href="#M000320">row</a>&nbsp;&nbsp;
      <a href="#M000318">table</a>&nbsp;&nbsp;
      <a href="#M000319">update_table</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000316" class="method-detail">
        <a name="M000316"></a>

        <div class="method-heading">
          <a href="#M000316" class="method-signature">
          <span class="method-name">included</span><span class="method-args">(base)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000316-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000316-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 3</span>
3:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
4:       <span class="ruby-identifier">base</span>.<span class="ruby-identifier">before_filter</span> <span class="ruby-identifier">:list_authorized?</span>, <span class="ruby-identifier">:only</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-identifier">:index</span>, <span class="ruby-identifier">:table</span>, <span class="ruby-identifier">:update_table</span>, <span class="ruby-identifier">:row</span>, <span class="ruby-identifier">:list</span>]
5:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000317" class="method-detail">
        <a name="M000317"></a>

        <div class="method-heading">
          <a href="#M000317" class="method-signature">
          <span class="method-name">index</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000317-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000317-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 7</span>
7:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">index</span>
8:       <span class="ruby-identifier">list</span>
9:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000321" class="method-detail">
        <a name="M000321"></a>

        <div class="method-heading">
          <a href="#M000321" class="method-signature">
          <span class="method-name">list</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000321-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000321-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 32</span>
32:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>
33:       <span class="ruby-identifier">do_list</span>
34: 
35:       <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
36:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">html</span> {
37:           <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>
38:         }
39:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">xml</span> { <span class="ruby-identifier">render</span> <span class="ruby-identifier">:xml</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_object</span>.<span class="ruby-identifier">to_xml</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_status</span> }
40:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_object</span>.<span class="ruby-identifier">to_json</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_status</span> }
41:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">yaml</span> { <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_object</span>.<span class="ruby-identifier">to_yaml</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">YAML</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_status</span> }
42:       <span class="ruby-keyword kw">end</span>
43:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000320" class="method-detail">
        <a name="M000320"></a>

        <div class="method-heading">
          <a href="#M000320" class="method-signature">
          <span class="method-name">row</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
get just a single <a href="List.html#M000320">row</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000320-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000320-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 28</span>
28:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">row</span>
29:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list_record'</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:record</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">find_if_allowed</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>], <span class="ruby-identifier">:read</span>)}
30:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000318" class="method-detail">
        <a name="M000318"></a>

        <div class="method-heading">
          <a href="#M000318" class="method-signature">
          <span class="method-name">table</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000318-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000318-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 11</span>
11:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">table</span>
12:       <span class="ruby-identifier">do_list</span>
13:       <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>)
14:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000319" class="method-detail">
        <a name="M000319"></a>

        <div class="method-heading">
          <a href="#M000319" class="method-signature">
          <span class="method-name">update_table</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This is called when changing pages, sorts and search
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000319-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000319-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 17</span>
17:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_table</span>
18:       <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
19:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">js</span> <span class="ruby-keyword kw">do</span>
20:           <span class="ruby-identifier">do_list</span>
21:           <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>)
22:         <span class="ruby-keyword kw">end</span>
23:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">return_to_main</span> }
24:       <span class="ruby-keyword kw">end</span>
25:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000322" class="method-detail">
        <a name="M000322"></a>

        <div class="method-heading">
          <a href="#M000322" class="method-signature">
          <span class="method-name">do_list</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
The actual algorithm to prepare for the <a
href="List.html#M000321">list</a> view
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000322-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000322-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 48</span>
48:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_list</span>
49:       <span class="ruby-identifier">includes_for_list_columns</span> = <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">columns</span>.<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">includes</span> }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">compact</span>
50:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">active_scaffold_joins</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">includes_for_list_columns</span>
51: 
52:       <span class="ruby-identifier">options</span> = {<span class="ruby-identifier">:sorting</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">sorting</span>,}
53:       <span class="ruby-identifier">paginate</span> = (<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:format</span>].<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> (<span class="ruby-identifier">accepts?</span> <span class="ruby-identifier">:html</span>, <span class="ruby-identifier">:js</span>) <span class="ruby-operator">:</span> [<span class="ruby-identifier">:html</span>, <span class="ruby-identifier">:js</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:format</span>])
54:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">paginate</span>
55:         <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge!</span>({
56:           <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">per_page</span>,
57:           <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">page</span>
58:         })
59:       <span class="ruby-keyword kw">end</span>
60: 
61:       <span class="ruby-identifier">page</span> = <span class="ruby-identifier">find_page</span>(<span class="ruby-identifier">options</span>);
62:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">items</span>.<span class="ruby-identifier">empty?</span>
63:         <span class="ruby-identifier">page</span> = <span class="ruby-identifier">page</span>.<span class="ruby-identifier">pager</span>.<span class="ruby-identifier">first</span>
64:         <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">page</span> = <span class="ruby-value">1</span>
65:       <span class="ruby-keyword kw">end</span>
66:       <span class="ruby-ivar">@page</span>, <span class="ruby-ivar">@records</span> = <span class="ruby-identifier">page</span>, <span class="ruby-identifier">page</span>.<span class="ruby-identifier">items</span>
67:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000323" class="method-detail">
        <a name="M000323"></a>

        <div class="method-heading">
          <a href="#M000323" class="method-signature">
          <span class="method-name">list_authorized?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
The default security delegates to <a
href="../../ActiveRecordPermissions.html">ActiveRecordPermissions</a>. You
may override the method to customize.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000323-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000323-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/list.rb, line 71</span>
71:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_authorized?</span>
72:       <span class="ruby-identifier">authorized_for?</span>(<span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:read</span>)
73:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>